<%--
  Created by IntelliJ IDEA.
  User: LuoQing
  Date: 2022/2/20
  Time: 15:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>生产派工单审核</title>
</head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
<style>
    #mutiValidation{
        display: none;
    }
    #wu{
        display: none;
    }
    .val{
        position: relative;
        top: 5px;
    }
</style>
<body>
<div class="row" id="cha" style="margin-top: 20px">
    <div class="row">
        <form class="form-inline">
            <div style="position: relative;left: 200px">
                请输入编号或者称号关键字：<input name="name" class="form-control">
                <input type="button" class="btn btn-primary" id="submit_select" value="查询"/>
            </div>
        </form>
    </div>
    <div class="container">
        <table id="table"  class="table table-hover table-bordered">
            <thead>
            <tr align="center">
                <th>生产派工单编号</th>
                <th>产品编号</th>
                <th>产品名称</th>
                <th>数量</th>
                <th>出库单编号集合</th>
                <th>登记时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
        </table>
    </div>
</div>

<FORM id=mutiValidation onsubmit="return doValidate('mutiValidation')&amp;&amp;TwoSubmit(this)" method=post><TABLE class=TABLE_STYLE3>
    <TBODY>
    <TR class=TR_STYLE1 height=20>
        <TD class=TD_HANDBOOK_STYLE1>您正在做的业务是：生产管理--生产调度管理--生产派工单审核</TD></TR></TBODY></TABLE>
    <TABLE class=TABLE_STYLE6 align=center>
        <TBODY>
        <TR class=TR_STYLE1 height=20>
            <TD class=TD_STYLE8 borderColorLight=#848284 borderColorDark=#eeeeee align=right  style="position:relative;left:400px"><INPUT onmouseup="this.className='btn3_mouseup'" onclick="tijiao()" onmouseover="this.className='btn3_mouseover'" onmousedown="this.className='btn3_mousedown'" onmouseout="this.className='btn3_mouseout'" type="button" class=SUBMIT_STYLE1  value=通过审核>&nbsp;<INPUT onmouseup="this.className='btn3_mouseup'" onclick="guan()" onmouseover="this.className='btn3_mouseover'" onmousedown="this.className='btn3_mousedown'" onmouseout="this.className='btn3_mouseout'" class=BUTTON_STYLE1 type=button value=返回></TD></TR></TBODY></TABLE>
    <DIV class=DIV_STYLE2>
        <TABLE cellSpacing=0 cellPadding=0 width=350 align=center bgColor=#ffffff border=0>
            <TBODY>
            <TR>
                <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
                    <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                        <TBODY>
                        <TR>
                            <TD height=10 colSpan=4>
                                <TABLE width="1000px">
                                    <TBODY>
                                    <TR>
                                        <TD>
                                            <TABLE class=TABLE_STYLE4 align=center>
                                                <TBODY>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                            <TABLE class=TABLE_STYLE4 align=center>
                                                <TBODY>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE5 height=5 align=center><FONT size=4><B>生产派工单</B></FONT></TD></TR></TBODY></TABLE>
                                            <TABLE class=TABLE_STYLE4 align=center>
                                                <TBODY>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                            <TABLE id=theObjTable class=TABLE_STYLE4 align=center>
                                                <TBODY>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>派工单编号：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="89%" colSpan=3 align=left><label class="val"></label></TD></TR>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>产品编号：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><label class="val"></label>&nbsp;</TD>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>产品名称：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><label class="val"></label>&nbsp;</TD></TR>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>数量&nbsp;&nbsp;&nbsp;&nbsp;：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><label class="val"></label>&nbsp;</TD>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>工单制定人：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT class=INPUT_STYLE3 value='' name=designer></TD></TR></TBODY></TABLE>
                                            <TABLE class=TABLE_STYLE4 align=center>
                                                <TBODY>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                            <TABLE  class=TABLE_STYLE5 borderColor=#000000 cellSpacing=0 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1>
                                                <THEAD>
                                                <TR class=TR_STYLE2 height=20 bgColor=#d2e9ff>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>序号</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>工序名称 </TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>工序编号 </TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>描述 </TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>工时数(小时)</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>单位工时成本（元）</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>工时成本小计（元）</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>查看物料 </TD></TR>
                                                </THEAD>
                                                <tbody id="wuliao"></tbody>
                                            </TABLE>
                                            <TABLE class=TABLE_STYLE4 align=center>
                                                <TBODY>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                            <TABLE class=TABLE_STYLE4 align=center>
                                                <TBODY>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>工时总成本：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><label class="val"></label>&nbsp;</TD>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>物料总成本：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><label class="val"></label>&nbsp;</TD></TR>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>登记人&nbsp;&nbsp;：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT class=INPUT_STYLE3 value=newer name=register></TD>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>登记时间：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT onfocus=setday(this) type=hidden value="" name=register_time><label class="val"></label></TD></TR>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>审核人&nbsp;&nbsp;：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT class=INPUT_STYLE3 value="${login_id}" name=checker></TD>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>审核时间：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT type=hidden value="2022-02-20 15:51:31" name=check_time>2022-02-20 15:51:31&nbsp;</TD></TR>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>描述&nbsp;&nbsp;&nbsp;&nbsp;：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><label class="val"></label>&nbsp;</TD>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>出库单编号：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left>&nbsp;</TD></TR>
                                                <TR class=TR_STYLE1 height=20>
                                                    <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>备注&nbsp;&nbsp;&nbsp;&nbsp;：</TD>
                                                    <TD class=TD_STYLE2 borderColor=#dedbd6 width="89%" colSpan=3 align=left><TEXTAREA  style="width: 100%" class=TEXTAREA_STYLE1 rows=4 name=remark></TEXTAREA> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
                        <TR>
                            <TD width=56 colSpan=3 noWrap></TD></TD></TR>
                        <TR>
                            <TD height=100 colSpan=3 noWrap></TD>
                            <TD></TD></TR>
                        <TR vAlign=bottom>
                            <TD colSpan=4 noWrap align=center></TD></TR></TD>
                        <TR>
                            <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
                <TD bgColor=#ffffff height=2 width=1></TD>
                <TD bgColor=#ffffff height=2 width=1></TD>
                <TD bgColor=#ffffff height=2 width=1></TD></TR>
            <TR>
                <TD bgColor=#333333 height=120 width=1></TD>
                <TD bgColor=#666666 height=120 width=1></TD>
                <TD bgColor=#999999 height=120 width=1></TD></TR>
            <TR align=right vAlign=top>
                <TD colSpan=4>
                    <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                        <TBODY>
                        <TR>
                            <TD bgColor=#333333 height=1></TD></TR>
                        <TR>
                            <TD bgColor=#666666 height=1></TD></TR>
                        <TR>
                            <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
            <TR align=right vAlign=middle>
                <TD colSpan=4></TD></TR></TBODY></TABLE></DIV><INPUT type=hidden value=17075de87a4c8a77b4c4c57be57e9d91 name=sumbit_submit> </FORM>

<div class="row" id="wu" style="margin-top: 20px">
    <div class="container">
        设计单编号：<label id="wubh" style="color: #ff0000"></label><h5>详细物料</h5>
        <TABLE  class=TABLE_STYLE5 borderColor=#000000 cellSpacing=0 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1>
            <THEAD>
            <TR class=TR_STYLE2 height=20 bgColor=#d2e9ff>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>序号</TD>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>物料名称 </TD>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>物料编号 </TD>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>描述 </TD>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>本工序数量</TD>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>单位</TD>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>单价（元）</TD>
                <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>小计 </TD></TR>
            </THEAD>
            <tbody id="xwuliao"></tbody>
        </TABLE>
        <button style="position: relative;right: -1000px" onclick="guan2()">关闭</button>
    </div>
</div>
</body>

<script src="/js/bootstrap-table-zh-CN.min.js"></script>
<script src="/js/jquery.form.js"></script>
<script src="/js/jquery.serializejson.js"></script>
<script>
    load()
    function load() {
        $("#table").bootstrapTable({
            method: "post",
            contentType: "application/json",
            url: "/cha/allShDan",
            striped: true,
            pageNumber: 1,
            pagination: true,
            sidePagination: "server",
            pageSize: 2,
            pageList: [2, 4, 6, 8],
            queryParams: function (param) {
                return {
                    page: (param.offset / param.limit) + 1,
                    num: param.limit,
                    cha: $("[name=name]:eq(0)").val(),
                }
            },
            columns: [
                {title: "生产派工单编号", field: "manufactureId", align: "center"},
                {title: "产品编号", field: "productId", align: "center"},
                {title: "产品名称", field: "productName", align: "center"},
                {title: "数量", field: "amount", align: "center"},
                {title: "出库单编号集合", field: "", align: "center"},
                {title: "登记时间", field: "registerTime", align: "center"},
                {
                    title: "操作", field: "manufactureId", align: "center",
                    formatter: function (value, row) {
                        var btn1 = "<button class='btn btn-primary btn-sm' onclick='dian(this)' data-toggle='modal' data-target=''>审核</button>";
                        return btn1 + "&nbsp;";
                    }
                },
            ]
        })
        $("#submit_select").click(function () {
            $("#table").bootstrapTable("refresh");
        })
    }
    function dian(value) {
        document.getElementById("mutiValidation").style.display='block';
        document.getElementById("cha").style.display='none';
        document.getElementById("wubh").innerText=value.parentNode.parentNode.querySelectorAll("td")[0].innerText;
        let innerText = value.parentNode.parentNode.querySelectorAll("td")[0].innerText;
        $.post("/cha/chaShDan",{manufactureId:innerText},function (data) {
            document.getElementsByClassName("val")[0].innerHTML=data.manufactureId;
            document.getElementsByClassName("val")[1].innerHTML=data.productId;
            document.getElementsByClassName("val")[2].innerHTML=data.productName;
            document.getElementsByClassName("val")[3].innerHTML=data.amount;
            document.getElementsByClassName("val")[4].innerHTML=data.labourCostPriceSum;
            document.getElementsByClassName("val")[5].innerHTML=data.moduleCostPriceSum;
            document.getElementsByClassName("val")[6].innerHTML=data.registerTime;
            document.getElementsByName("designer")[0].value=data.designer;
            document.getElementsByName("register")[0].value=data.register;
            document.getElementsByName("remark")[0].innerText=data.remark;
        })
        jiazai(value.parentNode.parentNode.querySelectorAll("td")[1].innerText)
    }
    function jiazai(xx) {
        $.ajax({
            url: "/cha/allGxu",
            data:xx,
            type:"post",
            dataType:"json",
            success:function (data) {
                $("#wuliao").empty()
                for(let i=0;i<data.length;i++){
                    $("#wuliao").append("<tr>" +
                        "<td>"+data[i].procedureId+"</td>"
                        +"<td>"+data[i].procedureName+"</td>"
                        +"<td>"+'0'+data[i].procedureId+"</td>"
                        +"<td>"+""+"</td>"
                        +"<td>"+data[i].labourHourAmount+"</td>"
                        +"<td>"+data[i].costPrice+"</td>"
                        +"<td>"+data[i].subtotal+"</td>"
                        +"<td><a onclick='cWu("+data[i].procedureId+")'>查看物料</a></td>"+
                        "</tr>")
                }
            }
        })
    }
    function cWu(id) {
        document.getElementById("mutiValidation").style.display='none';
        document.getElementById("cha").style.display='none';
        document.getElementById("wu").style.display='block';
        $.ajax({
            url: "/cha/allWuliao",
            data:JSON.stringify(id),
            contentType:"application/json;charset=utf-8",
            type:"post",
            dataType:"json",
            success:function (data) {
                $("#xwuliao").empty()
                for(let i=0;i<data.length;i++){
                    $("#xwuliao").append("<tr>" +
                        "<td>"+data[i].detailsInt+"</td>"
                        +"<td>"+data[i].productName+"</td>"
                        +"<td>"+data[i].productId+"</td>"
                        +"<td>"+""+"</td>"
                        +"<td>"+data[i].amount+"</td>"
                        +"<td>"+data[i].amountUnit+"</td>"
                        +"<td>"+data[i].costPrice+"</td>"
                        +"<td>"+data[i].subtotal+"</td>"
                        + "</tr>")
                }
            }
        })
    }
    function guan2() {
        document.getElementById("mutiValidation").style.display='block';
        document.getElementById("cha").style.display='none';
        document.getElementById("wu").style.display='none';
    }
    function guan() {
        document.getElementById("mutiValidation").style.display='none';
        document.getElementById("cha").style.display='block';
        document.getElementById("wu").style.display='none';
    }
    function tijiao() {
        $.post("/cha/updataMf",{wubh:document.getElementById("wubh").innerText},function (data) {
            if(data>0){
                alert("审核通过")
                document.getElementById("mutiValidation").style.display='none';
                document.getElementById("cha").style.display='block';
                load()
            }
        })
    }
</script>
</html>
